<script type="text/javascript">
    $(document).on('click','.sort-btn.action-btn',function () {
        var artid = $(this).attr('data-pkey');
        var sort = $(this).attr('data-sort');
        var content = '<fieldset>';
        content+='<label for="sorteditbox">排序</label>';
        content+='<input type="text" name="sorteditbox" style="width:80%;" value="'+sort+'"';
        content+='</fieldset>';
        layer.open({
            title:'',
            type:1,
            content:content,
            offset:'100px',
            btn:['修改','取消'],
            btnAlign:'c',
            yes:function () {
                var sortedit = $('input[name="sorteditbox"]').val();
                layer.confirm('确定保存修改么？',{title:'',offset:'100px'},function (index) {
                    layer.close(index);
                    layer.open({type:3,offset:'100px'});
                    $.ajax({
                        url:'http://admin.nldou.com/admin/salesman/salesmanarticle/editSort',
                        method:'GET',
                        data:{artid:artid,sort:sortedit},
                        dataType:"json",
                        xhrFields: {withCredentials: true},
                        success:function (res) {
                            layer.closeAll();
                            if(res.code=1) {
                                layer.msg('保存成功',{offset:'100px'});
                            }else{
                                layer.msg('发生错误请重试',{offset:'100px'});
                            }
                            window.location.reload();
                        },
                        timeout:function (res) {
                            layer.closeAll();
                            layer.msg('发生错误请重试',{offset:'100px'});
                        }
                    });
                });
            }
        });
    });
</script>